package com.cetc39.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.cetc39.bean.SubLifecycleLei;
import com.cetc39.dao.SubLifecycleLeiDao;

public class SubLifecycleLeiDaoImpl extends HibernateDaoSupport implements SubLifecycleLeiDao {

	@Override
	public void save(SubLifecycleLei s) {
		this.getHibernateTemplate().save(s);
	}

	@Override
	public void delete(int id) {
		this.getHibernateTemplate().delete(id);
	}

	@Override
	public void update(SubLifecycleLei s) {
		this.getHibernateTemplate().saveOrUpdate(s);
	}

	@Override
	public List<?> findAll() {
		return this.getHibernateTemplate().find("FROM SubLifecycleLei");
	}

	@Override
	public SubLifecycleLei findById(int id) {
		return this.getHibernateTemplate().get(SubLifecycleLei.class, id);
	}

	@Override
	public List<?> findByProjectId(int id) {
		List<?> l = this.getHibernateTemplate().find("FROM SubLifecycleLei WHERE project_id=?", new Object[]{id});
		return l;
	}

}
